package account;

import org.hibernate.Session;

import com.opensymphony.xwork2.ActionSupport;
import com.lt.member.Member;

import dao.HibernateSessionFactory;


public class AccountAction extends ActionSupport
{
    private AccountRecord accountRecord;
    private Member member;
    private double amount;
    
    /**
     * 充值
     * @return
     * @author liuding,2012-3-14
     */
    public String recharge(){
        Session s = HibernateSessionFactory.getSession();
        s.beginTransaction();
        Member m = (Member) s.get(Member.class, member.getId());
        s.getTransaction().commit();
        if(m != null){
            m.setBalance(amount+m.getBalance());
        }
        s.beginTransaction();
        s.update(m);
        s.getTransaction().commit();
        s.close();
        return null;
    }

    public AccountRecord getAccountRecord()
    {
        return accountRecord;
    }

    public void setAccountRecord(AccountRecord accountRecord)
    {
        this.accountRecord = accountRecord;
    }
}
